Shopify GraphQL
まずは慣れてから、概念把握したい。shopにinstall したい場合は、
GraphQlはグラフ理論. nodeとedgeをたどって情報を表示する。mutateの場合は該当するものに直接入れる。 Queries, Mutations, Objects の3つがある。そのまま見れば良い..
edgeとnodesの違いは気にする必要がない??? 違うかも...
Objectsについては詳細画面にある Mapについて読み取れることが大事?
https://gyazo.com/26ac7cf74dd7a4a43d097e7ef43c1deb
Graphなので、いろんな所から該当のObjectが取得できる。ぐるぐる廻る????
fieldsから来る場合もあるし、connectionから来る場合もある
connectionはqueryRootにない場合は、他のnodeのedge経由でconnetionを貼ることになる?
QueryRoot(Entry Point、起点になれるconnection)
connection: orders, customers, productsなどに sqlのfrom相当?
after, before, first, last, reverse, sortKeyを指定。order by, limitなどを指定
fields
filter parameters:
accepts_marketing
country
customer_date
email
last_abandoned_order_date
order_date
orders_count
phone
state
tag
total_spent
updated_at
term search, field search, range seach, Notの利用, Boolean,
カッコを使った優先付け(Grouping), pharse search, prefix query, エスケーピング, Exists(nullでないもの)
The Admin API supports a /search.json path for the Customer and GiftCard resources.
これだけ特別?
例
lineItemsがいくつあるかわからない場合は、どうすればよい?
適当に100とかいれておけばよい? 実際に使う actualQueryCostで、Availabilityは決まるので???
code:text
"cost": {
"requestedQueryCost": 32,
"actualQueryCost": 22,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 978,
"restoreRate": 50
}
}
code: graphQL_orders.json
{
orders(
first: 3,
query:"created_at:='2020-06-04'"
)
{
edges {
node {
id
email
createdAt
discountCode
publication {
id
name
}
lineItems(first:10){
edges{
node{
variant{
sku
price
compareAtPrice
}
}
}
}
}
}
}
}